﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MailBee.Outlook;

namespace RRSimulator.MsgToEml
{
    public class Program
    {
        public static void Main(string[] args)
        {
            string licenseKey = "MN700-B77F7FD77FC97F1A7F01ABCB6DC4-BBE0";
            int numOfProcess = 1;

            MailBee.Global.LicenseKey = licenseKey;

            try
            {
                MsgConvert msgConverter = new MsgConvert();

                Console.WriteLine("MailBee.NET license trial days left: {0} day(s)", msgConverter.TrialDaysLeft);
                Console.WriteLine("This simulator will execute converting from .msg file to .eml file.");
                Console.WriteLine("Number of converting process: {0} times", numOfProcess);

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                Console.WriteLine("Processing...");

                for (int i = 0; i < numOfProcess; i++)
                {
                    msgConverter.MsgToEml(@"..\..\Samples\Msg\Sample1.msg", string.Format(@"..\..\Samples\Eml\{0}", Guid.NewGuid()));
                }

                Console.WriteLine("Done.");
                stopwatch.Stop();
                Console.WriteLine("Elapsed time for executing {0} process is {1}", numOfProcess, string.Format("{0}:{1}", Math.Floor(stopwatch.Elapsed.TotalMinutes), stopwatch.Elapsed.ToString("ss\\.ff")));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : {0}", ex.Message);
            }
        }
    }
}
